package com.bibrApp.difu.actvity.others;

import android.content.Context;
import android.util.Log;

import com.bibrApp.difu.api.RetrofitNet;
import com.bibrApp.difu.base.BasePresenter;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

public class OtherPresenter extends BasePresenter<IOtherView> {
    public OtherPresenter(Context context, IOtherView iView) {
        super(context, iView);
    }


    /**
     * 广播btc交易
     * @param hash 16进制字符串（交易hash）
     */
    public void broadcastBtcTx(String hash) {
        RetrofitNet.getInstance().getApi(true)
                .broadcastTx("btc",hash)
                .compose(getActivityLifecycleProvider().bindToLifecycle())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io())
                .subscribe(o -> {
                    Log.d("dj","===广播==="+o);
                },throwable -> {
                    Log.e("dj",throwable.getMessage());
                });

    }
}
